﻿using Biomedica.Graphics;
using Microsoft.Kinect;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NuiDicomPlayer.Nui.Gestures
{
    /// <summary>
    /// Contain the buufer that all Gestures and Posture will use
    /// </summary>
    public class GesturPostureEngine
    {

        /// <summary>
        /// The Window Limit
        /// </summary>
        public int Limit { set; get; }
        /// <summary>
        /// The Time Buffer
        /// </summary>
        public  Queue<long> TBuffer { set; get; }
        /// <summary>
        /// The Skeleton Buffers
        /// </summary>
        public  Queue<Microsoft.Kinect.Skeleton> GPBuffer { set; get; }
        /// <summary>
        /// Push a new Skeleton to the Buffer
        /// </summary>
        /// <param name="vec">The new Skeleton To be bufferd</param>
        /// <param name="Time">The Time Stamp</param>
        public  void Push(Skeleton vec,long Time)
        {
            if (GPBuffer == null)
            {
                GPBuffer = new Queue<Microsoft.Kinect.Skeleton>();
                TBuffer = new Queue<long>();
            }
            if(Limit==0) Limit=60;

            GPBuffer.Enqueue(vec);
            TBuffer.Enqueue(Time);

            if (GPBuffer.Count > Limit)
            {
                GPBuffer.Dequeue();
                TBuffer.Dequeue();
            }

        }


        
    }
}
